home *** CD-ROM | disk | FTP | other *** search
/ Steal This CD / steal_this_cd.iso / Chapter 07 - Where the Hackers Are / virc200.exe / {app} / vircwb.txt < prev    next >
Text File  |  2003-05-16  |  5KB  |  137 lines

  1. ViRC Whiteboard Interface
  2. Jesse McGrew
  3. June 15, 2001
  4.  
  5. Introduction
  6. ============
  7.  
  8. ViRC 2's whiteboard is extremely powerful from a scripter's perspective. A
  9. script can create whiteboard windows, draw in them, react to drawing done
  10. either locally or remotely, selectively ignore drawing commands, or change
  11. commands before they are drawn or sent.
  12.  
  13. Whiteboard windows
  14. ==================
  15.  
  16. Whiteboard windows are similar to DCC chat windows. They have unique numeric
  17. names such as =!5, and non-unique names such as =!Mr2001.
  18.  
  19. ViRC automatically creates whiteboard windows for DCC whiteboard connections.
  20. Scripts can create them with the $NewWhiteboard() function:
  21.  
  22.   @ $wboard = $NewWhiteboard($title)
  23.  
  24. The supplied title will appear in the window's caption, and if it's a single
  25. word it can be used as the window's non-unique name (=!title). The function
  26. returns the window's unique name.
  27.  
  28. Drawing and manipulating the window
  29. ===================================
  30.  
  31. Commands marked *** are NOT IMPLEMENTED in 2.0pre8. Colors (<pencolor>, <fg>,
  32. etc.) can be given as hex RGB numbers ($bbggrr), their decimal equivalents, or
  33. cl* color constants (clRed, clBlue, etc. - not ecNotice, ecChanText).
  34.  
  35. Tool types are 0 for pencil, 1 for line, 3 for rectangle, 4 for ellipse, 5 for
  36. filled rectangle, 6 for filled ellipse, 8 for eraser, 9 for flood fill, 10 for
  37. arrow, and 11 for rubber stamp.
  38.  
  39. Begin recording to a file:
  40.   Whiteboard =!nick record <filename>
  41.  
  42. End recording:
  43.   Whiteboard =!nick norecord
  44.  
  45. Play back a recorded file:
  46.   Whiteboard =!nick play <filename>
  47.  
  48. Save the canvas to a bitmap:
  49.   Whiteboard =!nick save <file.bmp>
  50.  
  51. Load the canvas from a bitmap:
  52. (note: the loaded bitmap will not be sent over a DCC whiteboard connection)
  53.   Whiteboard =!nick load <file.bmp>
  54.  
  55. Save the canvas to the clipboard:
  56.   Whiteboard =!nick savetoclipboard
  57.  
  58. Load the canvas from the clipboard:
  59. (note: see above)
  60.   Whiteboard =!nick loadfromclipboard
  61.  
  62. Draw with a tool:
  63.   Whiteboard =!nick dr <tooltype> <width> <pencolor> <brushcolor> <x1,y1> <x2,y2>
  64.  
  65. Clear the canvas:
  66.   Whiteboard =!nick cls
  67.  
  68. Draw unstyled text in the default font:
  69.   Whiteboard =!nick txt <x,y> <text>
  70.  
  71. Draw styled text:
  72. (note: <style> is a sum of constants: 1 for bold, 2 for italic, 4 for
  73.  underline, 8 for strikeout)
  74.   Whiteboard =!nick txtex <x,y> <font>,<size> <style> <fg> <bg> <text>
  75.  
  76. *** Copy a block of canvas:
  77.   Whiteboard =!nick blt <x1src,y1src> <x2src,y2src> <xdest,ydest>
  78. *** Load a rubber stamp image:
  79.   Whiteboard =!nick img <name> <file.bmp>
  80. *** Make a rubber stamp image from a block of the canvas:
  81.   Whiteboard =!nick makeimg <name> <x1,y1> <x2,y2>
  82. *** Set the active tool:
  83.   Whiteboard =!nick settool <tooltype>
  84. *** Set the active rubber stamp:
  85.   Whiteboard =!nick setstamp <name>
  86. *** Begin entering text at a location:
  87.   Whiteboard =!nick entry <x,y>
  88. *** Set a clipping area:
  89.   Whiteboard =!nick clip <x1,y1> <x2,y2>
  90. *** Cancel clipping:
  91.   Whiteboard =!nick noclip
  92.  
  93. Send a raw drawing command over the DCC connection:
  94.   Whiteboard =!nick send <command>
  95.  
  96. Simulate a command coming in over DCC:
  97.   Whiteboard =!nick simulate <command>
  98.  
  99. Resize the canvas:
  100.   Whiteboard =!nick size <width,height>
  101.  
  102. Reacting to commands
  103. ====================
  104.  
  105. After the local or remote user draws on the whiteboard, the script will be
  106. notified with the events <OnWhiteboardAction> (remote user) or
  107. <OnMyWhiteboardAction> (local user). $0 is the unique window name, $1- is
  108. the command that was processed. Note that these events will not be called
  109. in response to scripted drawing commands.
  110.  
  111. This command is given in a similar format to the drawing commands above, but
  112. with spaces between parameters changed to commas: DR 1,1,0,0,10,10,50,50
  113.  
  114. NOCLIP may be reported as SPISPOPD for Doom nostalgia purposes. :)
  115.  
  116. Trapping commands
  117. =================
  118.  
  119. When a command has been given by the local or remote user, but before it is
  120. actually drawn or sent, the <OnTrapWhiteboardAction> or
  121. <OnTrapMyWhiteboardAction> events will be fired. As above, $0 is the unique
  122. window name, and $1- is the command.
  123.  
  124. The local variable $Command will also be set to the command, and the script
  125. can modify it to change the command (or set it to $null to cancel it).
  126.  
  127. For example, to change ellipses into rectangles and prevent clearing the
  128. canvas:
  129.  
  130.   Event <OnTrapMyWhiteboardAction_e2r> "% DR 4,*"
  131.     @l $Command = DR 3,$strtokr(, $Command)
  132.   EndEvent
  133.  
  134.   Event <OnTrapMyWhiteboardAction_nocls> "% CLS"
  135.     @l $Command = $null
  136.   EndEvent
  137.